function huaban_hdl(){
	//console.log()
	var toPost = [];
	$('#waterfall .pin .img img[width=192]').each(function(){
		var pic_url = $(this).attr('src'),
			pic_key = $(this).attr('src');
		pic_url = pic_url.replace(/_fw192$/,'_fw580');
		toPost.push({
			'pic_url' : pic_url,
			'pic_key' : pic_key,
			'source'  : 'huaban',
			'trust'   : 1
		});
	});

	//console.log(JSON.stringify(toPost));
	_submit(toPost);
};

function baidu_hdl(){
	var toPost = [];
	$('img[obj_url]').each(function(){
		var pic_url = $(this).attr('obj_url'),
			pic_key = 'baidu_' + $(this).attr('src');
		toPost.push({
			'pic_url' : pic_url,
			'pic_key' : pic_key,
			'source'  : 'baidu',
			'trust'   : 1
		});
	});

	_submit(toPost);
};

function diandian_hdl(){
	var toPost = [];
	$('img.feed-img').each(function(){
		var oriInfo = $(this).attr('data-origin-info');
		if(oriInfo && oriInfo.split(":").length >= 5 ){
			var infos = oriInfo.split(":"),
				pic_url = infos[0] + ":" + infos[1],
				width = parseFloat(infos[2]),
				height = parseFloat(infos[3]),
				key = infos[4];
			console.log(pic_url+"   " + width + "   " + height + "   " + key);
			toPost.push({
				'pic_url' : pic_url,
				'pic_key' : 'diandian_' + key,
				'source' : 'diandian'
			});
		}
		//console.log($(this).attr('data-origin-info') );
	});

	_submit(toPost);
}


phantom.injectJs('spider.js');
//百度
/*
spider.addTask({
	delay: 0,
	url: 'http://image.baidu.com/i?tn=list&word=liulan#%E7%BE%8E%E5%A5%B3|%E5%85%A8%E9%83%A8',
	handler: baidu_hdl
});
*/

//点点
spider.addTask({
	//url:'http://www.diandian.com/tag/美女',
	delay: 0,
	url:'http://www.diandian.com/tag/%E7%BE%8E%E5%A5%B3',
	handler: diandian_hdl
});

//花瓣
spider.addTask({
	delay: 0,
	url: 'http://huaban.com/favorite/beauty/',
	handler: huaban_hdl
});

//嘀咕
phantom.injectJs('engines/digu.js');

//我喜欢
phantom.injectJs('engines/woxihuan.js');